<script>
	import vhCheck from 'vh-check' //针对ios safari浏览器的100vh高度优化组件
	import WebPageSafe from '@/utils/common/webpagesafe.js' //JS基础安全防护
	import imMsg from "@/utils/common/message.js";
	export default {
		onLaunch: function() {
			console.log('App Launch')
			//正式环境开启JS常规防护
			if(process.env.NODE_ENV === 'production'){
				this.$nextTick(() => {
					new WebPageSafe(true)
				});
			}
			//优化100vh的高度问题
			vhCheck();
		},
		onShow: function() {
			console.log('App Show')
			if( this.$store.state.isLogin ){
				//更新用户信息，同步用户最新状态
				this.$store.dispatch('updateUserinfo').then(()=>{
					//登录IM
					if(!this.$store.state.imReady){
						imMsg.login()
					}
					this.$store.dispatch('updateBarNotice');
				}).catch((error)=>{
					console.log(error);
				})
			}
			//应用更新检查
			//this.$CHS.appUpdateCheck();
			//查询最新优惠活动
			this.$CHS.getCouponActivity()
		},
		onHide: function() {
			console.log('App Hide')
		},
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	@import '@/public/css/app.scss';
</style>
